New Algorithms for Regular Expression Matching
نویسنده
چکیده
In this paper we revisit the classical regular expression matching problem, namely, given a regular expression R and a string Q, decide if Q matches one of the strings specified by R. Let m and n be the length of R and Q, respectively. On a standard unit-cost RAM with word length w ≥ log n, we show that the problem can be solved in O(m) space with the following running times: O(nm log w w + m logw) if m > w O(n logm + m logm) if √ w < m ≤ w O(min(n + m, n logm + m logm)) if m ≤ √ w. This improves the best known time bound among algorithms using O(m) space. Whenever w ≥ log n it improves all known time bounds regardless of how much space is used.
منابع مشابه
A Boyer-Moore (or Watson-Watson) Type Algorithm for Regular Tree Pattern Matching
In this paper, I outline a new algorithm for regular tree pattern matching. The Boyer-Moore family of string pattern matching algorithms are considered to be among the most e cient. The Boyer-Moore idea of a shift distance was generalized by Commentz-Walter for multiple keywords, and generalizations for regular expressions have also been found. The existence of a further generalization to tree ...
متن کاملA Boyer-Moore-style algorithm for regular expression pattern matching
Richard E. Watson Dept. of Mathematics Simon Fraser University Burnaby B.C., Canada watsona@sfu. ca This paper presents a Boyer-Moore type algorithm for regular expression pattern matching, answering an open problem posed by A. V. Aho in 1980 [Aho80, p. 3421. The new algorithm handles patterns specified by regular expressions a generalization of the Boyer-Moore and Commentz-Walter algorithms (w...
متن کاملFast and compact regular expression matching
We study 4 problems in string matching, namely, regular expression matching, approximate regular expression matching, string edit distance, and subsequence indexing, on a standard word RAM model of computation that allows logarithmic-sized words to be manipulated in constant time. We show how to improve the space and/or remove a dependency on the alphabet size for each problem using either an i...
متن کاملA Collection of New Regular Grammar Pattern Matching Algorithms
A number of new algorithms for regular grammar pattern matching is presented. The new algorithms handle patterns speci ed by regular grammars | a generalization of multiple keyword pattern matching and single keyword pattern matching, both considered extensively in and [14, Chapter 4] and in [18]. Among the algorithms is a Boyer-Moore type algorithm for regular grammar pattern matching, answeri...
متن کاملA Subquadratic Algorithm for Approximate Regular Expression Matching
The main result of this paper is an algorithm for approximate matching of a regular expression of size m in a text of size n in time O(nm/ log d + 2 n), where d is the number of allowed errors. This algorithm is the first o(mn) algorithm for approximate matching to regular expressions.
متن کامل